<?php
/**
 * Integration test with Example3.
 *
 * @author      Frank Kleine <mikey@xjconf.net>
 * @package     XJConf
 * @subpackage  test_integration
 */
require_once EXAMPLES_DIR . '/Color.php';
require_once EXAMPLES_DIR . '/Complex.php';
require_once EXAMPLES_DIR . '/UpperString.php';
/**
 * Integration test with Example3.
 *
 * @package     XJConf
 * @subpackage  test_integration
 */
class Example3TestCase extends UnitTestCase
{
    /**
     * test if example3 works
     */
    public function testExample3()
    {
        $tagParser  = new DefinitionParser();
        $defs       = $tagParser->parse(EXAMPLES_DIR . '/xml/defines3.xml');
        $namespaces = array('http://schst.net/test' => 'http://schst.net/test', 'http://schst.net/bar' => 'http://schst.net/bar');
        foreach ($defs->getDefinedNamespaces() as $key => $namespace) {
            $this->assertEqual($namespace->getNamespaceURI(), $namespaces[$key]);
        }
        
        $conf = new XmlParser();
        $conf->setTagDefinitions($defs);
        $conf->parse(EXAMPLES_DIR . '/xml/test3.xml');
        
        $this->assertEqual($conf->getConfigValue('zahl'), 12);
        $this->assertEqual($conf->getConfigValue('text'), "Now the tag 'foo' is used as a string");
    }
}
?>